import { createContext, render } from 'react';
import { BrowserRouter as Router,Route,Link} from 'react-router-dom';
import React,{useState,useEffect,useContext} from 'react';
import Hook from './Hook good'
import $ from "jquery"

const Home = ()=>{
  return <h1>HOME</h1>
}
const News = (props)=>{
  console.log(props);
  return <h1>{props.location.state.content}</h1>
}
const About = ()=>{
  return <h1>About</h1>
}

const App = ()=>{
  return(
    <Router>
      <header>
        <Link to='/' >首页</Link> 
        <Link to={{
          pathname:'/about',
          state:{id:111, content:'<h2>帖子详情</h2>'}
          }} >关于</Link>
        {/* <Link to='/news' >新闻</Link>
        <Link to='/user' >用户</Link> */}
      </header>
      <switch>
        <Route exact path="/" component={Home} />
        <Route path="/about" component={About}></Route>
        <Route path="/:tab" component={News} />
      </switch>
    </Router>
  )
}
export default App;
